/*
 * Copyright © 2022 Dowsure
 * https://www.dowsure.com/
 *
 * All rights reserved.
 */

package com.dowsure.apisaas.api;

import com.dowsure.apisaas.enums.MethodEnums;
import com.dowsure.apisaas.exception.ApiException;
import com.dowsure.apisaas.model.PlatformRuleRequestParams;
import com.dowsure.apisaas.util.ApiClient;
import com.dowsure.apisaas.util.ApiResponse;
import com.dowsure.apisaas.util.RequestParamValidatedUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @description: 平台
 * @author: Dowsure
 * @create: 2022-02-15 09:53
 **/
public class PlatformApi {

    private ApiClient apiClient;

    public PlatformApi(ApiClient apiClient){
        this.apiClient = apiClient;
    }


    /**
     * 5、设置准入规则（API-T02）
     * 用户可以调用该接口完成对平台的准入规则设置，后续卖家进入会根据用户设置的规则推送至用户侧
     * @author Dowsure
     * @param platformRuleRequestParams {@link PlatformRuleRequestParams}
     * @return {@link ApiResponse <List<String>>}
     * @throws ApiException
     */
    public ApiResponse<List<String>> rule(PlatformRuleRequestParams platformRuleRequestParams) throws ApiException {
        RequestParamValidatedUtils.validated(platformRuleRequestParams);
        String localVarPath = "/v1/platform/rule";

        Map<String, String> headerParams = new HashMap<>();
        com.squareup.okhttp.Call call = apiClient.buildCall(localVarPath, MethodEnums.POST, platformRuleRequestParams, headerParams);
        return apiClient.execute(call);
    }


}

